import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

/// 轻提示工具类
class ToastUtil {
  //  单例模式写法2 - static 静态类

  /// 显示成功提示（绿色）
  static void showSuccess(String message) {
    Fluttertoast.showToast(
        msg: message,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        backgroundColor: Colors.green,
        textColor: Colors.white,
        webPosition: 'center',
        webBgColor: '#5591af');
  }

  /// 显示错误提示（红色）
  static void showError(String message) {
    Fluttertoast.showToast(
        msg: message,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        webPosition: 'center',
        webBgColor: '#ff0000');
  }

  /// 显示信息提示（蓝色）
  static void showInfo(String message) {
    Fluttertoast.showToast(
        msg: message,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        backgroundColor: Colors.blue,
        textColor: Colors.white,
        webPosition: 'center',
        webBgColor: '#4D78CC');
  }
}
